local love = require "love"
local Music = {}

function Music.new(self, name, mode, volumn)
    local object = {}
    self.__index = self
    setmetatable(object, self)

    object.name = name
    object.mode = mode or "static"
    object.volumn = volumn or 0.9
    object.music = love.audio.newSource(object.name, object.mode)
    object.music:setVolume(object.volumn)

    return object
end

function Music.play(self, loop, replay)
    loop = loop or false
    replay = replay or false

    if replay then love.audio.stop(self.music) end
    self.music:setLooping(loop)
    love.audio.play(self.music)
end

return Music
